#ifndef _Command_h_
#define _Command_h_

#include <string>
#include <sstream>
#include <fstream>
#include <iostream>
#include <cstring>

using namespace std;

class Command {
public:
	Command() : x(0), y(0), file("replay.bin") {}
  
  ~Command() {}
  
  Command(int q, int w) : x(q), y(w), file("replay.bin") {}

  virtual string toString() {
    stringstream ss;
    ss << "X:" << x << " Y:" << y;
    return ss.str();
  }

  virtual void save(ofstream &ofs) {
    ofs.write((char*) &x, sizeof(int));
    ofs.write((char*) &y, sizeof(int));
  }

  virtual void load(ifstream &ifs) {
    ifs.read((char*) &x, sizeof(int));
    ifs.read((char*) &y, sizeof(int));
  }

	virtual void setValues(int q, int w) {
		x = q;
		y = w;
	}

protected:
  int x;
  int y;
  char *file;
};

#endif
